# Use an official Python runtime as a parent image
FROM python:3.9


# Set environment varibles
ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# Set work directory
WORKDIR /usr/src/app

# Install dependencies
COPY requirements.txt /usr/src/app/

RUN python -m pip install -i https://mirrors.aliyun.com/pypi/simple --upgrade pip
RUN pip install -r requirements.txt -i https://mirrors.aliyun.com/pypi/simple
RUN pip install gunicorn -i https://mirrors.aliyun.com/pypi/simple

# Copy project
COPY ./build/lib.linux-x86_64-cpython-39/ /usr/src/app/

# Expose the port the app runs on
EXPOSE 8015

# Command to run the application
CMD ["gunicorn", "--bind", "0.0.0.0:8015", "djangoProject.wsgi:application"]
